package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.GuaranteeExtMapper;
import com.mhc.suzuki.dal.model.GuaranteeDO;
import com.mhc.suzuki.dal.query.GuaranteeQuery;
import com.mhc.suzuki.manager.GuaranteeManager;
import com.mhc.suzuki.vo.GuaranteeListVO;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * Manager for Guarantee.
 */

@Component
public class GuaranteeManagerImpl implements GuaranteeManager{

    
    @Autowired
    protected GuaranteeExtMapper guaranteeExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(GuaranteeQuery query){
        return guaranteeExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(GuaranteeQuery query){
        return guaranteeExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(GuaranteeDO record){
        return guaranteeExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(GuaranteeDO record){
        return guaranteeExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<GuaranteeDO> selectByQuery(GuaranteeQuery query){
        return guaranteeExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<GuaranteeDO> selectByQueryWithPage(GuaranteeQuery query) {
        PageResult<GuaranteeDO> result = new PageResult<GuaranteeDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public GuaranteeDO selectByPrimaryKey(Long id){
        return guaranteeExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( GuaranteeDO record,  GuaranteeQuery query){
        return guaranteeExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( GuaranteeDO record,  GuaranteeQuery query){

        return guaranteeExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(GuaranteeDO record){
        return guaranteeExtMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<GuaranteeListVO> selectListByQuery(Map<String, ?> paramMap) {
        return guaranteeExtMapper.selectListByQuery(paramMap);
    }

    @Override
    public int countListByQuery(Map<String, ?> paramMap) {
        return guaranteeExtMapper.countListByQuery(paramMap);
    }
}